<template>
  <div class="hotSelling">
    <van-nav-bar
      title="热卖"
      left-text="返回"
      left-arrow
      @click-left="$router.go(-1)"
      @click-right="$router.push('/search')"
    >
      <template #right>
        <i class="iconfont icon-sousuo"></i>
      </template>
    </van-nav-bar>
    <van-swipe :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) of swiUrl" :key="index"
        ><img :src="item" alt="" style="width: 100%"
      /></van-swipe-item>
    </van-swipe>
    <div class="channel_box">
      <div class="official_show">
        <div class="official_item">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/13565da27fc7008f7af05f9806284d38.png"
          />
          <span>官方商城</span>
        </div>
        <div class="official_item">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/e383e0827bca18bf004e94ca5cdf6dc8.png"
          />
          <span>正品保障</span>
        </div>
        <div class="official_item">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/7dd2b3dda5c5c3e547f922cd206d6498.png"
          />
          <span>售后无忧</span>
        </div>
      </div>
      <div class="classify">
        <div class="classify_item">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/72cdf6382fd5d77411e85ecb6d38a49d.png?w=130&amp;h=130&amp;bg=7F0000"
          />
          <p>商务本</p>
        </div>
        <div class="classify_item">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/72cdf6382fd5d77411e85ecb6d38a49d.png?w=130&amp;h=130&amp;bg=7F0000"
          />
          <p>商务本</p>
        </div>
        <div class="classify_item">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/72cdf6382fd5d77411e85ecb6d38a49d.png?w=130&amp;h=130&amp;bg=7F0000"
          />
          <p>商务本</p>
        </div>
        <div class="classify_item">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/72cdf6382fd5d77411e85ecb6d38a49d.png?w=130&amp;h=130&amp;bg=7F0000"
          />
          <p>商务本</p>
        </div>
        <div class="classify_item">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/72cdf6382fd5d77411e85ecb6d38a49d.png?w=130&amp;h=130&amp;bg=7F0000"
          />
          <p>商务本</p>
        </div>
      </div>
    </div>
    <div style="border-top: 0.16rem solid transparent"></div>
    <div class="spell_url">
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/8655f2129b27bbf29d7057167e513a08.png?f=webp"
        alt=""
      />
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/548049aac05099cbd75b8c3d4f367479.png?f=webp"
        alt=""
      />
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/f85df74ab0d914d5d02d9ad63ec2468a.png?f=webp"
        alt=""
      />
    </div>
    <div class="spell_url">
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/2cdaefc69ed6791aac97de60b502aaa9.jpg?f=webp"
        alt=""
      />
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/e8540cc025037986fed831eabfa7cfd8.jpg?f=webp"
        alt=""
      />
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/775b56aed13cbd200c2a7a14bcca18e7.jpg?f=webp"
        alt=""
      />
    </div>
    <div class="channel_title">
      <div class="title">热销排行</div>
    </div>
    <div class="hot_sale">
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
      <div class="goods_item">
        <div class="text_box">
          <div class="goods_title">
            小米平板5 系列<small style="color: rgb(131, 131, 131)"
              >11英寸大屏|2.5K超清显示</small
            >
          </div>
          <div class="goods_price">
            <div class="org_price">1999<span>起</span></div>
          </div>
          <div class="goods_tag" style="background-color: rgb(236, 96, 85)">
            99.8%好评
          </div>
        </div>
        <div class="img-box">
          <img
            src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ed0541d2337dc4fff6e52c2b7f162fe5.jpg?thumb=1&amp;w=280&amp;h=280"
          />
        </div>
      </div>
    </div>
    <div class="channel_title">
      <div class="title">限时抢购</div>
    </div>
    <div class="channel_product">
      <div class="goods_item" style="background-color: rgb(132, 144, 237)">
        <div class="img_box">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/47de0b1dd0087b71eb044957bbc9e66c.png"
          />
        </div>
        <div class="goods_content">
          <div class="goods_title">
            Redmi 23.8英寸<small>1080P画质 | 7.3mm薄机身</small>
          </div>
          <div class="goods_tag" style="color: rgb(132, 144, 237)">
            99.5%好评
          </div>
          <div class="img_box">
            <img
              src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/d4cb0fb895244ce875a5b79b4d676a22.png?thumb=1&amp;w=280&amp;h=280"
            />
          </div>
          <div class="goods_price">
            <div class="org_price price">849</div>
            <del class="price">899</del>
          </div>
        </div>
      </div>
      <div class="goods_item" style="background-color: rgb(132, 144, 237)">
        <div class="img_box">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/47de0b1dd0087b71eb044957bbc9e66c.png"
          />
        </div>
        <div class="goods_content">
          <div class="goods_title">
            Redmi 23.8英寸<small>1080P画质 | 7.3mm薄机身</small>
          </div>
          <div class="goods_tag" style="color: rgb(132, 144, 237)">
            99.5%好评
          </div>
          <div class="img_box">
            <img
              src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/d4cb0fb895244ce875a5b79b4d676a22.png?thumb=1&amp;w=280&amp;h=280"
            />
          </div>
          <div class="goods_price">
            <div class="org_price price">849</div>
            <del class="price">899</del>
          </div>
        </div>
      </div>
      <div class="goods_item" style="background-color: rgb(132, 144, 237)">
        <div class="img_box">
          <img
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/47de0b1dd0087b71eb044957bbc9e66c.png"
          />
        </div>
        <div class="goods_content">
          <div class="goods_title">
            Redmi 23.8英寸<small>1080P画质 | 7.3mm薄机身</small>
          </div>
          <div class="goods_tag" style="color: rgb(132, 144, 237)">
            99.5%好评
          </div>
          <div class="img_box">
            <img
              src="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/d4cb0fb895244ce875a5b79b4d676a22.png?thumb=1&amp;w=280&amp;h=280"
            />
          </div>
          <div class="goods_price">
            <div class="org_price price">849</div>
            <del class="price">899</del>
          </div>
        </div>
      </div>
    </div>
    <div class="recommend_lists">
      <div
        class="recommend_list"
        v-for="(item, index) of recommend"
        :key="index"
        @click="$router.push('/details')"
      >
        <div class="list_img">
          <img :src="'https:' + item.image_url" />
        </div>
        <div class="list_info">
          <div class="list_name">{{ item.name }}</div>
          <div class="list_price price">
            ￥{{ item.price
            }}<del class="price" v-if="item.market_price !== item.price"
              >￥{{ item.market_price }}</del
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { recommend } from "../assets/js/shuju.js";
import Vue from "vue";
import { Swipe, SwipeItem, NavBar } from "vant";
Vue.use(NavBar);
Vue.use(Swipe);
Vue.use(SwipeItem);

export default {
  name: "hotSelling",
  data() {
    return {
      swiUrl: [
        "https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/50c49b8899f7ccac90c40cdc7d72c963.png?w=1080&h=900&bg=9C",
        "https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b5ceb60f3b8397844c0a8cda0b427add.jpg?w=1080&h=900&bg=E0D0AC",
        "https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/50c49b8899f7ccac90c40cdc7d72c963.png?w=1080&h=900&bg=9C",
      ],
      recommend: null,
    };
  },
  created() {
    this.recommend = recommend;

  },
};
</script>

<style lang="less">
.hotSelling {
  background: #f2f2f2;
  .van-nav-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgb(242, 242, 242);
    .van-nav-bar__left {
      .van-icon,
      .van-nav-bar__text {
        font-size: 16px;
        line-height: 46px;
        color: #8a8a8a;
      }
    }
  }
  .channel_box {
    background: #fff;
    border-radius: 0.16rem;
    padding: 0.24rem 0;
    margin: 0 0.24rem;
    .official_show {
      margin-bottom: 0.24rem;
      display: flex;
      .official_item {
        width: 100%;
        text-align: center;
        color: rgba(0, 0, 0, 0.25);
        flex: 1 1 auto;
        img {
          display: inline-block;
          vertical-align: middle;
          width: 0.24rem;
          height: 0.24rem;
        }
        span {
          vertical-align: middle;
          font-size: 0.2rem;
          margin-left: 0.08rem;
        }
      }
    }
    .classify {
      display: flex;
      .classify_item {
        flex: 1 1 auto;
        img {
          width: 0.86rem;
          margin: 0 auto;
        }
        p {
          line-height: 2.6em;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          transform: scale(0.98);
          text-align: center;
        }
      }
    }
  }
  .spell_url {
    img {
      width: 2.5rem;
      height: 2.4rem;
      display: inline-block;
    }
  }
  .channel_title {
    padding: 0.24rem 0;
    margin: 0 0.24rem;
    .title {
      font-size: 0.32rem;
      font-weight: 700;
    }
  }
  .hot_sale {
    background: #fff;
    border-radius: 0.16rem;
    overflow: hidden;
    flex-wrap: wrap;
    margin: 0 0.24rem;
    align-items: center;
    display: flex;
    .goods_item {
      box-sizing: border-box;
      width: 50%;
      height: 1.86rem;
      position: relative;
      overflow: hidden;
      .text_box {
        position: absolute;
        z-index: 2;
        top: 0.24rem;
        left: 0.24rem;
        right: 0.24rem;
        text-align: left;
        .goods_title {
          font-size: 0.28rem;
          font-weight: 700;
          width: 2.2rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          small {
            display: block;
            line-height: 1.6em;
            color: rgba(0, 0, 0, 0.5);
            font-size: 0.24rem;
            font-weight: 400;
            width: 1.9rem;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
        .goods_price {
          font-size: 0.24rem;
          margin: 0.16rem 0 0.08rem;
          align-items: center;
          display: flex;
          .org_price {
            padding-left: 0;
            position: relative;
            line-height: 1em;
            span {
              display: inline-block;
              vertical-align: baseline;
              transform-origin: center bottom;
              transform: scale(0.8);
            }
          }
        }
        .goods_tag {
          display: inline-block;
          padding: 0 0.08rem;
          line-height: 0.28rem;
          border-radius: 0.04rem;
          color: #fff;
          max-width: 1.32rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          transform-origin: left top;
          transform: scale(0.94);
        }
      }
      .img-box {
        position: absolute;
        z-index: 1;
        top: 0.56rem;
        right: 0.16rem;
        width: 1.28rem;
        height: 1.28rem;
        img {
          display: block;
          width: 100%;
          height: auto;
        }
      }
    }
  }
  .channel_product {
    overflow: hidden;
    margin: 0 0.24rem;
    align-items: center;
    display: flex;
    .goods_item {
      position: relative;
      display: block;
      box-sizing: border-box;
      width: 100%;
      height: 3.2rem;
      overflow: hidden;
      color: #fff;
      margin-left: 0.16rem;
      border-radius: 0.16rem;
      flex: 1 1 auto;
      .img_box {
        img {
          display: block;
          width: 100%;
          height: auto;
        }
      }
      .goods_content {
        position: absolute;
        top: 0.2rem;
        left: 0;
        width: 100%;
        .goods_title {
          font-size: 0.26rem;
          font-weight: 700;
          margin: 0 auto;
          width: 1.9rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;

          small {
            display: block;
            line-height: 2em;
            font-size: 0.2rem;
            font-weight: 400;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
        .goods_tag {
          display: block;
          width: 1.44rem;
          padding: 0 0.16rem;
          line-height: 0.36rem;
          border-radius: 0.36rem;
          background-color: #fff;
          margin: 0 auto;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          transform: scale(0.94);
        }
        .goods_price {
          font-size: 0.28rem;
          font-weight: bolder;
          justify-content: center;
          align-items: center;
          display: flex;
          .price {
            position: relative;
            padding-left: 0;
            line-height: 1em;
          }
          del {
            display: block;
            font-weight: 400;
            transform-origin: center bottom;
            transform: scale(0.7);
            opacity: 0.5;
          }
        }
        .img_box {
          width: 1.44rem;
          height: 1.44rem;
          margin: 0 auto;
        }
      }
      &:first-child {
        margin-left: 0;
      }
    }
  }
  .recommend_lists {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 0.24rem;
    .recommend_list {
      flex: 0 0 49%;
      width: 49%;
      background: #fff;
      margin:0.12rem 0 ;
      .list_img {
        width: 100%;
        img {
          width: 100%;
        }
      }
      .list_info {
        padding: 0.18rem 0.26rem 0.22rem;
        .list_name {
          font-size: 0.28rem;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .list_price {
          font-size: 0.32rem;
          color: #ff6700;
          margin-top: 0.1rem;
          del {
            font-size: 0.22rem;
            margin-left: 0.1rem;
            color: rgba(0, 0, 0, 0.54);
            text-decoration: line-through;
          }
        }
        .price {
          position: relative;
          padding-left: 0.5em;

          line-height: 1em;
        }
      }
    }
  }
}
</style>